﻿using System;
using System.Collections.Generic;

namespace YArchitech.Temp
{
	public class HYDuctSpecificationComparer : IComparer<HYDuctSpecification>
	{
		public bool Ascending { get; set; }

		public HYDuctSpecificationComparer(bool ascending = true)
		{
			this.Ascending = ascending;
		}

		public int Compare(HYDuctSpecification s1, HYDuctSpecification s2)
		{
			if (this.Ascending)
			{
				if (!(s1 > s2))
				{
					return -1;
				}
				return 1;
			}
			else
			{
				if (!(s1 < s2))
				{
					return -1;
				}
				return 1;
			}
		}
	}
}
